package com.iwhalecloud.bss.kite.cucc.spec.inf.impl;

import com.google.common.collect.Maps;
import com.iwhalecloud.bss.kite.cucc.common.callclient.HttpCallClient;
import com.iwhalecloud.bss.kite.cucc.common.callclient.constant.CallClientEnum;
import com.iwhalecloud.bss.kite.cucc.spec.inf.IQueryGoodsService;
import org.springframework.stereotype.Service;

import java.util.HashMap;
import java.util.Map;

@Service
public class QueryGoodsService implements IQueryGoodsService {

	@SuppressWarnings("unchecked")
    @Override
	public Map<String, Object> queryGoodsByOfferId(String offerId) {
		Map<String, Object> busiMap = new HashMap<>();
        busiMap.put("APP_ID", "kite");
        busiMap.put("goodsSku", offerId);
        busiMap.put("touchPlatform", "1");
        Map<String, Object> goodsMap = HttpCallClient.post(CallClientEnum.QRY_GOODS_INFO, busiMap);
        Map<String, Object> dataMap = (Map<String, Object>) goodsMap.get("data");
        if (dataMap == null) {
            return Maps.newHashMap();
        }
        return dataMap;
	}

}
